home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
borland
/
prbgi097.zip
/
PRINTBGI.DOC
< prev
next >
Wrap
Text File
|
1992-12-15
|
14KB
|
280 lines
#define C_only
#define Pascal_only
Documentation of PRINTBGI package v0.97 (C) Andrzej Resztak 1991,1992,
all rights reserved.
To contact the author write to
Andrzej Resztak
ul. K. Wallenroda 2c/18
20-607 Lublin
POLAND
or (preferably) to e-mail address:
Resztak@PLUMCS11.bitnet
Introduction
============
This is the version 0.97 of my PrintBGI toolkit. It was developed to
help programmers using Borland languages (Borland/Turbo C(++)
or Turbo Pascal) and BGI drivers to print graphics on the printer
(and in the future on the other devices) as easy as you can draw it
on the screen. In fact even more, the same function can produce
it's output on a screen or on a printer according to conditions
at which it was called.
It's really easy to learn. Developing your own applications does
not require writing two similar procedures (one for screen drawing
and the other for printer or plotter).
Maintenance of the code is simple, since all extensions or bug fixes
must be made in one place only. I hope you will enjoy this package.
For registration, license and payment see REGISTER.DOC.
#if kkkkk
For examples description see EXAMPLE.DOC.
#endif
This file contains all technical news you must understand to use
this package easy and effectively.
It is quite possibly that this program may not work on your
printer. For example I have never tested it on original IBM printer.
Of course it was tested on some compatible printers but I cannot be
quite sure which command is "compatible" and which is an enhancement.
So please, let me know if this program does not work with your printer.
My address is given at the end of this file.
SOME OVERVIEW
==============
This package can be divided into two independent parts. First is
BGI driver called by me BItImage BGI driver. This driver can be used
to create bit maps of any size of any picture. Note however that
the BGI driver does only some low level work (hardware specific) and
in most cases it depends on high level routines contained in Borland
graphics library kernel. Since there are some differences between printer
and screen oriented devices the initialization of my BitImage BGI
driver is somewhat different of initialization of standard Borland
video BGI drivers. For example it cannot perform any auto detection;
specifying printer being used does not determine the size of the graphic
output and there is some more minor differences. Because of these
differences you must call some PRT_Setxxxxxxx functions of the package to
specify parameters at which you want the BitImage driver to work. And
initialization of the driver should be done using PRT_initgraph function
instead of standard initgraph routine.
The second part of the package make routines contained in PRTGRAPH library
which hide some of the differences between my BitImage driver and
standard Borland video drivers. They also will make it very easy to print
something on your output device (currently only the dot matrix printers).
Now I describe you the easiest way you can add graphic output
to your programs using this PRINTBGI toolkit. Other sections
will let you know some more features, but this section is very good
for beginning, I hope.
#if C_only
For C users.
First, I highly recommend you to include prototypes of all functions
defined in PRINTBGI package by just inserting
#include <PRTGRAPH.H>
statement at the beginning of your module. Although it is not
necessary I also recommend you to place PRTGRAPH module after any standard
modules you use. It'll enable me some tricky modifications in the future
versions of this package.
You must also remember about linking in PRTGRAPH.LIB either
listing it in PRJ file in integrated environment or adding at the
command line invoking stand alone version of the compiler (or linker).
#endif C_only
#if Pascal_only
For Pascal users.
You must list PRTGRAPH unit (among other units you are using) in the
uses clause. You may also list PDrivers unit if you want to use symbolic
constants defined in it.
Although it is not necessary I recommend you to place PRTGRAPH
module after any standard modules you use. It'll enable me some tricky
modifications in the future versions of this package.
#endif Pascal_only
Next I assume that you like modular structure programming and have
routine called (say) DrawFunc which meets following conditions.
- It draws on the screen the picture you want to print it out.
- It does not use any nonstandard procedures (that is not
defined in GRAPH.TPU or GRAPHICS.LIB) to manipulate screen
output.
- It does not use initgraph,restorecrtmode,closegraph or setgraphmode
function. It simply assumes that appropriate graphic mode was
established before calling it and will be close down after
it finishes.
- It is written in BGI independent way. That is it uses getmaxx,
getmaxy, getmaxcolor, getaspectratio to get device dependent
characteristic and scales all output according to it.
- If you are using my recommended way to print your picture out, that
is you are using PRT_PrintBGI function then it may happen that this
function will call your drawing routine few or several times to print
out the whole picture. This may happen when there is not enough free
memory to build the whole bit image map of the picture at once. In
that case the bit map will be created piece by piece (each time
calling your drawing routine).
So, although it is not necessary it is recommended that your routine
will draw the same picture (pixel in pixel) each time it will be
called by PRT_PrintBGI function. Of course in the next invoke
of the PRT_PrintBGI routine your DrawFunc may draw something
completely different.
- It is declared as huge function if you are using C compiler.
( If it is not your case (you don't have such a function) you may
either rewrite your code to have such a function or use some lower
level functions included in this package. I once again highly
recommend you to choose the first method. )
If you have such a function you must inform the package what kind
of printer you have and at what resolution you want it to operate.
To do that just call PRT_SetPrinterDrv function with appropriate parameters
PrinterNo and ModeNo (use constants defined in PRTGRAPH.H or in
PRTGRAPH.PAS) and PRT_SetPicture to define size and other picture options.
For example the following statements may print out picture drawn by
DrawFunc on the IBM ProPrinter.
#if C_only
{ /* C version */
int PRTdrv,PRTmode,ReturnCode;
PRT_LinkDrivers(); /* link drivers definitions into an executable code
*/
PRT_SetPrinterDrv ( IBM9, IBM9_120x72 );
PRT_SetPicture ( 4000,3000, PRT_INVERSE );
PRTdrv = DETECT;
PRTmode=0;
/* If you want you may linked in the BitImage BGI driver into the */
/* EXE file. To do so remove comment markers from the following two lines. */
/* PRTdrv = PRT_installuserdriver ( "BitImage", NULL ); */
/* PRT_registerfarbgidriver ( BitImage ); */
ReturnCode = PRT_PrintBGI ( &PRTdrv,&PRTmode,"d:\\bc\\bgi",
DrawFunc, NULL );
}
#endif
#if Pascal_only
(* Pascal version *)
var PRTdrv,PRTmode,ReturnCode : integer;
Begin
rc:=PRT_LinkDrivers; { link drivers definitions into an executable code
}
PRT_SetPrinterDrv ( IBM9, IBM9_120x72 );
PRT_SetPicture ( 4000,3000, PRT_INVERSE );
{ rc := PRT_SetOutName('file.tst'); }
PRTdrv := DETECT;
PRTmode := 0;
(* If you want you may linked in the BitImage BGI driver into the *)
/* EXE file. To do so remove comment markers from the following two lines.